This invention relates to apparatus and a method for controlling the focus of a camera.
Two types of autofocus are typically employed in compact digital cameras and smartphones: contrast detection autofocus and phase detection autofocus.
With contrast detection autofocus, a sequence of frames is captured by the camera and the level of contrast is monitored in defined areas of the frames. The autofocus system adjusts the focus setting of the camera until the contrast in one or more of the areas is maximised and the camera is considered to be in focus. The focus setting of a camera may be described in terms of the focus distance, i.e. the distance in front of the camera at which objects will appear in focus in the image.
Phase detection is achieved through the use of additional hardware. A beam splitter is used to split incoming light into two components (e.g. red and green light) and direct it to a sensor. The sensor determines the degree of focus from the relative separation of the two light components. The sensor can also determine whether the focus distance of the camera needs to be increased or decreased from the relative direction of separation of the two light components: if the longer wavelength light is one side of the sensor compared to the shorter wavelength light then the focus distance is to be increased, and if the longer wavelength light is one side of the sensor compared to the shorter wavelength light then the focus distance is to be decreased.
Contrast detection autofocus typically performs less well than phase detection autofocus. In particular, because the contrast data captured at the device does not include distance information, the device cannot initially determine whether the focus distance of the camera needs to be increased or decreased in order to focus on an object. The device must capture at least two frames and modify the focus distance in a known way between those frames in order to determine whether the change(s) in focus distance improved or worsened the contrast in the captured frames. Furthermore, because the device must process each captured image in order to determine the contrast information in the defined areas of the image, the processing time can delay the point at which the autofocus can update that focus distance of the camera by at least another frame. As a result, contrast detection autofocus is typically significantly slower than phase detection autofocus.
A camera pipeline in a digital camera or smartphone which uses contrast detection autofocus will usually offer a predefined set of focus zones—regions of the image, typically at and around the centre of the frame, at which the camera is capable of performing autofocus. In this case, the camera pipeline would typically be configured to calculate contrast information for each of the zones for use by the autofocus system. This ensures that contrast information is available to the autofocus system at minimal delay. However, in the drive to improve point-and-shoot camera performance, it is becoming increasingly important for autofocus systems to be able to define custom autofocus zones according to the scene captured in the frames. For example, modern camera pipelines often perform face detection, with the autofocus system being configured to define autofocus zones for the faces detected in the frame. This can significantly exacerbate the delays in contrast detection autofocus system.
Processing images (e.g. performing face detection) to identify focus zones is typically an intensive operation which cannot be performed synchronously with frame capture by the camera. In order to perform contrast detection autofocus based on focus zones defined for a frame, it is normally necessary for (a) one or more frames to be captured in which focus zones are identified, (b) the autofocus system to define the custom focus zones at the camera pipeline so as to enable the pipeline to provide suitable contrast statistics for those zones, and (c) wait for at least two frames to be captured for which the camera pipeline provides contrast statistics for the custom zones. Only then is the autofocus system in a position to control the focus distance of the camera using the focus zones identified in the camera pipeline. Even on the latest hardware, this entire process will typically require several frames in order for focus to be achieved.
The limitations of contrast detection autofocus are pushing device manufacturers to, at least in high-end devices, adopt phase detection autofocus systems. The additional phase detection hardware increases the complexity, size and cost of devices.